﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CS2102_Music.Logic.LogicModels;

namespace CS2102_Music.Controllers
{
    public class AdminController : Controller
    {
        //
        // GET: /Admin/

        private Logic.Logic logic = Logic.Logic.GetInstance(new Logic.DbConnector());

        public ActionResult Index()
        {
            bool prevLogIn = false;
            UserL user = new UserL();

            if (Session["User"] != null)
            {
                //already logined as customer when navigate to this page
                prevLogIn = true;
                user = (UserL)Session["User"];
                ViewBag.type = user.IsAdmin;
                ViewBag.email = user.Email;
                ViewBag.password = user.Password;
                ViewBag.name = user.Name;

            }
            else
            {
                prevLogIn = false;
            }

            ViewBag.loggedIn = prevLogIn;

            return View();
        }

    }
}
